func twoDimConvertOneDim(arr [][]int) []int {
    rows := len(arr)
    cols := len(arr[0])

    res := make([]int, rows*cols)
    for i := 0; i < rows; i++ {
        for j := 0; j < cols; j++ {
            index := i*cols + j
            res[index] = arr[i][j]
        }
    }

    return res
}

func oneDimConvertTwoDim(arr []int, rows int, cols int) [][]int {
    res := make([][]int, rows)
    for i := range res {
        res[i] = make([]int, cols)
    }

    for index := 0; index < len(arr); index++ {
        i := index / cols
        j := index % cols
        res[i][j] = arr[index]
    }
    return res
}

func printAdj(arr [][]int, i int, j int) {
    rows := len(arr)
    cols := len(arr[0])

    directions := [][]int {
            {-1, 0}, {1, 0}, {0, -1}, {0, 1},
            {-1, -1}, {-1, 1}, {1, -1}, {1, 1},
     }

    for _, dir := range directions {
        row := i + dir[0]
        col := j + dir[1]
        if row < rows && col < cols && row >= 0 && col >= 0 {
            fmt.Println(arr[row][col])
        }
    }
}